export function cDioData({ propData, emit, formEmitsObj, dataed }: { dataed: any; propData: CSuperFormPropsDataType; emit: (event: string, ...args: any[]) => void; formEmitsObj: any }) {
  return {
    open: dataed.value?.open ?? propData?.cDioOpt?.open ?? false,
    subLoading: dataed.value?.subLoading ?? false,
    formParams: propData.formParams,
    cDioOpt: propData.cDioOpt,
    formEmitsObj,
    emit
  };
}
export function cDioFn(data: any) {
  const methods = {
    showDialog(params: any) {
      data.value.open = true;
      nextTick(() => {
        if (!data.value.cFormRef) return;
        data.value.cFormRef.resetfile(params);
        // data.value.cFormRef.form = Object.assign({}, params);
      });
    },
    submitForm: async () => {
      try {
        let res = await data.value.cFormRef?.submitForm();
        if (!res) return;
        data.value.subLoading = true;
        if (!data.value.cDioOpt?.notSaveAfter)
          data.value.emit("getListFn", {
            fn: () => {
              ElMessage.success("保存成功");
              data.value.open = false;
              data.value.subLoading = false;
            }
          });
      } catch (error) {
        console.log(error);
        data.value.subLoading = false;
      }
    }
  };
  return methods;
}
